package com.feynman.pattern.observer.gperadvice;

import java.util.Observable;

/**
 * JDK提供的观察者模式
 */

public class Gper extends Observable {
    public String getName() {
        return name;
    }

    private String name = "Gper生态圈";

    private static Gper gper = null;
    private Gper() {
    }
    public static Gper getInstance(){
        if(null == gper){
            gper = new Gper();
        }
        return gper;
    }

    public void publishQuestion(Question question)
    {
        System.out.println(question.getUserName()+ this.name + "上提交了一个问题");
        setChanged();
        notifyObservers(question);

    }
}
